<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>项目资料详情信息</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
	<div class="fieldset1 tabel_col tabel_col_s clearFix">
		<div class="sqPanel">
			<div class="sqPanel_head inL">
			    <span>客户资料</span>
			     <c:if test="${ pianflag != '101'}">
			    <span class="btns"><span class="sq-button sq-button-round" onclick="downloadCstFileByUrl();">打包下载</span></span>
			    </c:if>
			</div>
            <div class="sqPanel_body">
			    <div id="cstFileInfoCfgGrid" class="sq-grid"></div>
            </div>
		</div> 
		<c:if test="${ pianflag != '101'}">
		<div class="sqPanel">
			<div class="sqPanel_head inL">
			    <span>担保人资料</span>
			</div>
            <div class="sqPanel_body">
			    <div id="guarFileInfoCfgGrid" class="sq-grid"></div>
            </div>
		 </div> 
		</c:if>
		
		<div class="sqPanel">
			<div class="sqPanel_head inL">
			    <span>项目资料</span>
			     <c:if test="${ pianflag != '101'}">
			    <span class="btns"><span class="sq-button sq-button-round" onclick="downloadPrjFileByUrl();">打包下载</span></span>
			    </c:if>
			</div>
            <div class="sqPanel_body">
			    <div id="prjFileInfoCfgGrid" class="sq-grid"></div>
            </div>
		</div> 
		<%--<div class="sqPanel" <c:if test="${prjTypCd!='GHKD' && insCode!='icbc' || pianflag == '101'}">style="display: none"</c:if>>--%>
			<%--<div class="sqPanel_head inL">--%>
			    <%--<span>狮桥对客合同</span>--%>
			    <%----%>
			    <%--<span class="btns"><span class="sq-button sq-button-round" onclick="downloadPrjLionCstFileByUrl();">打包下载</span></span>--%>
			<%--</div>--%>
            <%--<div class="sqPanel_body">--%>
			    <%--<div id="prjLionCstFileInfoCfgGrid" class="sq-grid"></div>--%>
            <%--</div>--%>
		<%--</div> --%>
		<%--<div class="sqPanel" <c:if test="${prjTypCd!='GHKD' && insCode!='icbc' || pianflag == '101'}">style="display: none"</c:if>>--%>
			<%--<div class="sqPanel_head inL">--%>
			    <%--<span>三方对客合同</span>--%>
			    <%--<span class="btns"><span class="sq-button sq-button-round" onclick="downloadPrjTrigonalCstFileByUrl();">打包下载</span></span>--%>
			<%--</div>--%>
            <%--<div class="sqPanel_body">--%>
			    <%--<div id="prjTrigonalCstFileInfoCfgGrid" class="sq-grid"></div>--%>
            <%--</div>--%>
		<%--</div> --%>
		<%--<div class="sqPanel" <c:if test="${prjTypCd!='GHKD' && insCode!='icbc' || pianflag == '101'}">style="display: none"</c:if>>--%>
			<%--<div class="sqPanel_head inL">--%>
			    <%--<span>三方对客视频</span>--%>
			    <%--<span class="btns"><span class="sq-button sq-button-round" onclick="downloadPrjTrigonalCstVideoByUrl();">打包下载</span></span>--%>
			<%--</div>--%>
            <%--<div class="sqPanel_body">--%>
			    <%--<div id="prjTrigonalCstVideoInfoCfgGrid" class="sq-grid"></div>--%>
            <%--</div>--%>
		<%--</div> --%>
		<div class="sqPanel">
			<div class="sqPanel_head inL">
			    <span>项目租赁物列表</span>
			</div>
            <div class="sqPanel_body">
			    <div id="prjPrdDtlListGrid" class="sq-grid"></div>
            </div>
		</div>
		<div class="sqPanel">
			<div class="sqPanel_head inL">
				<span>保单列表</span>
			</div>
			<div class="sqPanel_body">
				<div id="insPlcBscInfoListGrid" class="sq-grid"></div>
			</div>
		</div>
</div>
<!-- 资料上传DIV -->
<div id="prj_file_div" style="display:none">
    <form id="prj_file_formSet">
        <div class="fieldset1 tabel_col noBorder clearFix">
            <div class="fieldBox col_100">
                <jsp:include page="../../system/sysUlFilesRec/sysSysUlFilesRecUpload.jsp" flush="true" >
                    <jsp:param name="fileNum" value="1"/>
                    <jsp:param name="filePath" value="prjFileInfo"/>
                </jsp:include>
            </div>
        </div>
        <input type="text" style="display: none;" id="cfgCd" name="cfgCd">
        <input type="text" style="display: none;" id="cfgDtlCd" name="cfgDtlCd">
        <input type="text" style="display: none;" id="orgCd" name="orgCd">
        <input type="text" style="display: none;" id="cstId" name="cstId" value="${cstId}">
        <input type="text" style="display: none;" id="prjId" name="prjId" value="${prjId}">
	</form>
</div>
<script type="text/javascript">
    var prjFileInfoCfgGrid = null;//项目资料配置明细
    var cstFileInfoCfgGrid = null;//客户资料配置明细
    var prjLionCstFileInfoCfgGrid = null;
    var prjTrigonalCstFileInfoCfgGrid = null;
    var prjTrigonalCstVideoInfoCfgGrid = null;
        var ctrlKey='${ctrlKey}';
    $(function () {
        //客户资料配置明细Grid
        cstFileInfoCfgGrid = $("#cstFileInfoCfgGrid").ligerGrid({
            <%--url: '<%=path%>/project/prjFileInfo/initFileListByDataId.do?cstMgrOrgCd=${cstMgrOrgCd}&dataId=${cstId}',--%>
			url: '<%=path%>/project/prjFileCfgInfo/initCstFileInfoList.do?isShowSts=0&cstId=${cstId}&prjId=${prjId}&type=1',
			method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false},
                {display: '上传文件名称', name: 'fileNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function ()
            {
                $('#cstFileInfoCfgGrid').rowspan('datNm');
            },
        });

        //项目资料Grid
        prjFileInfoCfgGrid = $("#prjFileInfoCfgGrid").ligerGrid({
            <%--url: '<%=path%>/project/prjFileInfo/initFileListByDataId.do?cfgCd=${cfgCd}&cstMgrOrgCd=${cstMgrOrgCd}&dataId=${prjId}',--%>
			url: '<%=path%>/project/prjFileCfgInfo/initPrjFileInfoList.do?isShowSts=0&cstMgrOrgCd=${cstMgrOrgCd}&prjId=${prjId}&prjTypCd=${prjTypCd}',
			method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false},
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            //return '<a target="_blank" name="showimg" href="'+rowdata.filePath+'">'+rowdata.fileNm+'</a>';
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            rowAttrRender: function (rowdata,rowid)
            {
               if ( '${pianflag}' == '101' && rowdata.datNm!='室内与申请人合影')
               {
              	   //alert("55");
                     //return "style='background:#48D9AE;'";
                      var manager = $("#prjFileInfoCfgGrid").ligerGetGridManager();
						manager.deleteRow(rowdata);
              	   return "style='display:none;'";
                }
              return "";
            },

            onAfterShowData: function (){
                $('#prjFileInfoCfgGrid').rowspan('datNm');
            },
        });
        //项目资料Grid - 狮桥对客合同
        prjLionCstFileInfoCfgGrid = $("#prjLionCstFileInfoCfgGrid").ligerGrid({
            url: '<%=path%>/project/prjFileInfo/initFileListByDataId.do?cfgCd=PRJ019&cstMgrOrgCd=${cstMgrOrgCd}&dataId=${prjId}',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false},
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            //return '<a target="_blank" name="showimg" href="'+rowdata.filePath+'">'+rowdata.fileNm+'</a>';
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function (){
                $('#prjLionCstFileInfoCfgGrid').rowspan('datNm');
            },
        });
        //项目资料Grid - 三方对客合同
        prjTrigonalCstFileInfoCfgGrid = $("#prjTrigonalCstFileInfoCfgGrid").ligerGrid({
            url: '<%=path%>/project/prjFileInfo/initFileListByDataId.do?cfgCd=PRJ020&cstMgrOrgCd=${cstMgrOrgCd}&dataId=${prjId}',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false},
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            //return '<a target="_blank" name="showimg" href="'+rowdata.filePath+'">'+rowdata.fileNm+'</a>';
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function (){
                $('#prjTrigonalCstFileInfoCfgGrid').rowspan('datNm');
            },
        });
        //项目资料Grid - 三方对客合同
        prjTrigonalCstVideoInfoCfgGrid = $("#prjTrigonalCstVideoInfoCfgGrid").ligerGrid({
            url: '<%=path%>/project/prjFileInfo/initFileListByDataId.do?cfgCd=PRJ021&cstMgrOrgCd=${cstMgrOrgCd}&dataId=${prjId}',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false},
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            //return '<a target="_blank" name="showimg" href="'+rowdata.filePath+'">'+rowdata.fileNm+'</a>';
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function (){
                $('#prjTrigonalCstVideoInfoCfgGrid').rowspan('datNm');
            },
        });

        
		$("#prjPrdDtlListGrid").ligerGrid({
	    	url: '<%=path%>/project/prjprddtl/initList.do?prjId=${prjId}',
	    	method : 'get',
	        columns: [
	            { display: '支付表编号', name: 'paySchNo', width: 300,
	            	render: function (rowdata, rowindex, value, column) { 
	            		var h = '';
	            	       if(rowdata.paySchNo){
		                        h+='<a class="sq-button-hasicon" href="javascript:detailBtn(';
		                        h+="'"+rowdata.id+"',";
		                        if(rowdata.paySchId){
		                        h+="'"+rowdata.paySchId+"',";
		                        }else{
		                        	 h+="'',";
		                        }
		                        h+="'"+rowdata.prjPrdId+"'";
		                        h+=')">'+value+'</a>'
		                        }
	                        return h;
	            		}
	            },
	            { display: '产品名称', name: 'prdNm', width: 300 ,enabledSort:true},
	            { display: '产品型号', name: 'prdMdl', width: 300,enabledSort:true},
	             {
	                display: '操作',
	                isSort: false,
	                width: 130,
	                render: function (rowdata, rowindex, value){
	                	  var h="";
	                        h='<a class="sq-button-hasicon" href="javascript:uploadPrjPrdFile(';
							h+="'"+rowdata.id+"',";
							h+="'"+rowdata.prjId+"',";
						 	h+="'"+rowdata.prjPrdId+"',";
							h+="'"+rowdata.paySchNo+"'";
	                        h+=')"><i class="sqBtnIco_4"></i>资料信息</a>';
	                    return h;
	                }
	            }  
	        ],
	        pageSize:100,
	        root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            usePagerOnLessPagesize: true,
	        onAfterShowData: function ()
            {
            	SetIframe_height();
            },
	    });
		
		$("#guarFileInfoCfgGrid").ligerGrid({
	    	url: '<%=path%>/project/prjcstbscInfo/initList.do?prjId=${prjId}&cstRlTyp='+ProjectConstant.CST_RL_SPONSOR,
	    	method : 'get',
	        columns: [
	            { display: '名称', name: 'cstNm', width: 150 },
	            { display: '担保人类型', name: 'cstTypCdNm', width: 150 ,enabledSort:true},
	            <c:if test="${ pianflag != '101'}">
	            { display: '证件类型', name: 'certTypCdNm', width: 200,enabledSort:true},
	            { display: '证件号', name: 'certNo', width: 300,enabledSort:true},
	            </c:if>
	             {
	                display: '操作',
	                isSort: false,
	                width: 130,
	                render: function (rowdata, rowindex, value){
	                	  var h="";
	                        h='<a class="sq-button-hasicon" href="javascript:uploadGuarFile(';
							h+="'"+rowdata.cstId+"','"+rowdata.prjId+"','"+rowdata.id+"'";
							h+=')"><i class="sqBtnIco_4"></i>资料信息</a>';
	                    return h;
	                }
	            }  
	        ],
	        root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
	        onAfterShowData: function ()
            {
            	SetIframe_height();
            },
	    });


        $("#insPlcBscInfoListGrid").ligerGrid({
            url: '<%=path%>/insurance/insPlcBscInfo/initList.do?prjId=${prjId}',
            method : 'get',
            columns: [
                { display: '支付表编号', name: 'paySchNo', width: 300,
                    render: function (rowdata, rowindex, value, column) {
                        var h = '';
                        if(rowdata.paySchNo){
                            h+='<a class="sq-button-hasicon" href="javascript:detailBtn(';
                            h+="'"+rowdata.id+"',";
                            if(rowdata.paySchId){
                                h+="'"+rowdata.paySchId+"',";
                            }else{
                                h+="'',";
                            }
                            h+="'"+rowdata.prjPrdId+"'";
                            h+=')">'+value+'</a>'
                        }
                        return h;
                    }
                },
                {display: '保单号', name: 'plcNo', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(!value||value==null||value=='null'){
                            return '<a href="javascript:;" onclick="queryPlcDtl('+rowdata.id+')">保单</a>';
                        }
                        return '<a href="javascript:;" onclick="queryPlcDtl('+rowdata.id+')"><span class="gridTip" title="保单查看">'+rowdata.plcNo+'</span></a>';
                    }
                },
                {display: '保险种类', name: 'insTypCdNm', minWidth: 100, align: 'center', enabledSort: false},
                {
                    display: '操作',
                    isSort: false,
                    width: 130,
                    render: function (rowdata, rowindex, value){
                        var h="";
                        h='<a class="sq-button-hasicon" href="javascript:uploadInsPlcBscInfoFile(';
                        h+="'"+rowdata.id+"',";
                        h+="'"+rowdata.prjId+"'";
                        h+=')"><i class="sqBtnIco_4"></i>资料信息</a>';
                        return h;
                    }
                }
            ],
            pageSize:100,
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            usePagerOnLessPagesize: true,
            onAfterShowData: function ()
            {
                SetIframe_height();
            },
        });
        $("#pageloading").hide();
    });
    
    function downloadCstFileByUrl() {
        var data = cstFileInfoCfgGrid.getData();
      	//var files = [];
        var ids = [];
		for (var i = 0; i < data.length; i++) {
		    var map = {};
		    /* if(data[i].filePath){
			    map.name = data[i].fileNm;
			    map.path = data[i].filePath.substring(data[i].filePath.indexOf("attachments"));
			    files.push(map);
		    } */
		    ids.push(data[i].fileId);
		}
		var actoinURL = '<%=path%>/system/sysulfilesrec/zipDownloadById.do?';
    	var form = $("<form>");
        $('body').append(form);
        form.attr('style','display:none');
        form.attr('target','');
        form.attr('method','post');
        form.attr('action',actoinURL);//下载文件的请求路径
        var input = $('<input>');
        input.attr('type','hidden');
        input.attr('name','ids');
        input.attr('value',JSON.stringify(ids));
        form.append(input);
        form.submit();
    }
    function downloadPrjFileByUrl() {
        var data = prjFileInfoCfgGrid.getData();
     	//var files = [];
        var ids = [];
		for (var i = 0; i < data.length; i++) {
		    var map = {};
		    /* if(data[i].filePath){
			    map.name = data[i].fileNm;
			    map.path = data[i].filePath.substring(data[i].filePath.indexOf("attachments"));
			    files.push(map);
		    } */
		    ids.push(data[i].fileId);
		}
		var actoinURL = '<%=path%>/system/sysulfilesrec/zipDownloadById.do?';
    	var form = $("<form>");
        $('body').append(form);
        form.attr('style','display:none');
        form.attr('target','');
        form.attr('method','post');
        form.attr('action',actoinURL);//下载文件的请求路径
        var input = $('<input>');
        input.attr('type','hidden');
        input.attr('name','ids');
        input.attr('value',JSON.stringify(ids));
        form.append(input);
        form.submit();
    }
    function downloadPrjLionCstFileByUrl() {
        var data = prjLionCstFileInfoCfgGrid.getData();
     	//var files = [];
        var ids = [];
		for (var i = 0; i < data.length; i++) {
		    var map = {};
		    /* if(data[i].filePath){
			    map.name = data[i].fileNm;
			    map.path = data[i].filePath.substring(data[i].filePath.indexOf("attachments"));
			    files.push(map);
		    } */
		    ids.push(data[i].id);
		}
		var actoinURL = '<%=path%>/system/sysulfilesrec/zipDownloadById.do?';
    	var form = $("<form>");
        $('body').append(form);
        form.attr('style','display:none');
        form.attr('target','');
        form.attr('method','post');
        form.attr('action',actoinURL);//下载文件的请求路径
        var input = $('<input>');
        input.attr('type','hidden');
        input.attr('name','ids');
        input.attr('value',JSON.stringify(ids));
        form.append(input);
        form.submit();
    }
    function downloadPrjTrigonalCstFileByUrl() {
        var data = prjTrigonalCstFileInfoCfgGrid.getData();
     	//var files = [];
        var ids = [];
		for (var i = 0; i < data.length; i++) {
		    var map = {};
		    /* if(data[i].filePath){
			    map.name = data[i].fileNm;
			    map.path = data[i].filePath.substring(data[i].filePath.indexOf("attachments"));
			    files.push(map);
		    } */
		    ids.push(data[i].id);
		}
		var actoinURL = '<%=path%>/system/sysulfilesrec/zipDownloadById.do?';
    	var form = $("<form>");
        $('body').append(form);
        form.attr('style','display:none');
        form.attr('target','');
        form.attr('method','post');
        form.attr('action',actoinURL);//下载文件的请求路径
        var input = $('<input>');
        input.attr('type','hidden');
        input.attr('name','ids');
        input.attr('value',JSON.stringify(ids));
        form.append(input);
        form.submit();
    }
    function downloadPrjTrigonalCstVideoByUrl() {
        var data = prjTrigonalCstVideoInfoCfgGrid.getData();
     	//var files = [];
        var ids = [];
		for (var i = 0; i < data.length; i++) {
		    var map = {};
		    /* if(data[i].filePath){
			    map.name = data[i].fileNm;
			    map.path = data[i].filePath.substring(data[i].filePath.indexOf("attachments"));
			    files.push(map);
		    } */
		    ids.push(data[i].id);
		}
		var actoinURL = '<%=path%>/system/sysulfilesrec/zipDownloadById.do?';
    	var form = $("<form>");
        $('body').append(form);
        form.attr('style','display:none');
        form.attr('target','');
        form.attr('method','post');
        form.attr('action',actoinURL);//下载文件的请求路径
        var input = $('<input>');
        input.attr('type','hidden');
        input.attr('name','ids');
        input.attr('value',JSON.stringify(ids));
        form.append(input);
        form.submit();
    }
    
    $(function () {
        $(document).on('click', 'a[name=showimg]', function(){
            event.preventDefault();
            var href = $(this).attr('href');
            reg = new RegExp('^.*\.(?:png|jpg|bmp|gif|jpeg|PNG|JPG|BMP|GIF|JPEG)$');
            if (reg.test(href)) {
                SQ.imgPreview(href);
            }else{
                window.open(href);
            }
        });
    });
    
    function uploadPrjPrdFile(dtlId,prjId,prjPrdId,paySchNo){
        <%--Add_navTab('prjPrdDtl_detail'+dtlId,'租赁物资料信息','<%=path%>/project/prjFileInfo/toPrjPrdDtlFileInfoListPageDetail.do?pianflag=${pianflag}&&cstMgrOrgCd=${cstMgrOrgCd}&ctrlKey=${ctrlKey}'+'&prjPrdDtlId='+dtlId+'&prjId=${prjId}&prjTypCd=${prjTypCd}');--%>
        Add_navTab('prjPrdDtl_detail'+dtlId,'租赁物资料信息','<%=path%>/project/prjFileCfgInfo/toPrjPrdDtlFileInfoListPageDetail.do?pianflag=${pianflag}&&cstMgrOrgCd=${cstMgrOrgCd}&ctrlKey=${ctrlKey}'+'&prjPrdDtlId='+dtlId+'&prjTypCd=${prjTypCd}&prjId='+prjId+'&prjPrdId='+prjPrdId+'&paySchNo='+paySchNo);
	}
	//担保人资料信息
	function  uploadGuarFile(cstId,prjId,prjCstId){
        <%--Add_navTab('guarFileInfo_detail'+cstId,'担保人资料信息','<%=path%>/project/prjFileInfo/toGuarFileInfoListPageDetail.do?cstMgrOrgCd=${cstMgrOrgCd}&ctrlKey=${ctrlKey}'+'&cstId='+cstId);--%>
        Add_navTab('guarFileInfo_detail'+cstId,'担保人资料信息','<%=path%>/project/prjFileCfgInfo/toGuarFileInfoListPageDetail.do?cstMgrOrgCd=${cstMgrOrgCd}&ctrlKey=${ctrlKey}'+'&cstId='+cstId+'&prjId='+prjId+'&prjCstId='+prjCstId);
    }
    //保单资料
    function uploadInsPlcBscInfoFile(plcId,prjId){
        Add_navTab('insPlcBscInfo'+plcId,'保单资料信息','<%=path%>/project/prjFileCfgInfo/toInsPlcBscInfoFileInfoListPageDetail.do?cstMgrOrgCd=${cstMgrOrgCd}&ctrlKey=${ctrlKey}'+'&plcId='+plcId+'&prjId='+prjId);
    }
    //查询保单详情
    function queryPlcDtl(_id){
        Add_navTab('InsPlcBscInfo_DTL_'+_id, "保单详情", '<%=path%>/insurance/insPlcBscInfo/toDetailPage.do?id='+_id, null);
    }
    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

    var reloadChildGridId = null;
    var callbackFlag = 3;
    //上传客户文件
    function upFileForCst(event,_cfgCd,_cfgDtlCd,_orgCd){
    	//获取子GridID
    	event.stopPropagation();
        reloadChildGridId = $(event.target).parents('.sq-grid').attr('ligeruiid');
        
    	callbackFlag = 1;
        $("#cfgCd").val(_cfgCd);
        $("#cfgDtlCd").val(_cfgDtlCd);
        $("#orgCd").val(_orgCd);
        $.ligerDialog.SQopen({
            width: 400,
            height:100,
            title : '资料上传',
            target: $("#prj_file_div"),
        });
    }
    //上传客户文件回调方法
    function uploadCallback_2(_data){
    	if(callbackFlag==1){
	        $.ajax({
	            type: 'post',
	            dataType: 'json',
	            data: {'fileParams':JSON.stringify(_data),'cstId':$("#cstId").val(),'cfgCd':$("#cfgCd").val(),'cfgDtlCd':$("#cfgDtlCd").val(),'orgCd':$("#orgCd").val()},
	            url: '<%=path%>/project/prjFileInfo/uploadCstFile.do',
	            success: function (msg) {
	                if (msg.success == 1) {
	                    parent.$('li[tabid="mateTab"] a').text('客户资料('+msg.data+')');
	                    /* if(cstFileInfoGrid){
		                    cstFileInfoGrid.reload();
	                    } */
		                if(reloadChildGridId) liger.get(reloadChildGridId).reload();
	                }else{
	                    $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
	                }
	                $.ligerDialog.hide();
	            }
	        });
    	}
    }
    
  	//上传项目文件
    function upFileForPrj(event,_cfgCd,_cfgDtlCd,_orgCd){
  		//获取子GridID
    	event.stopPropagation();
        reloadChildGridId = $(event.target).parents('.sq-grid').attr('ligeruiid');
        
    	callbackFlag = 2;
        $("#cfgCd").val(_cfgCd);
        $("#cfgDtlCd").val(_cfgDtlCd);
        $("#orgCd").val(_orgCd);
        $.ligerDialog.SQopen({
            width: 400,
            height:100,
            title : '资料上传',
            target: $("#prj_file_div"),
        });
    }
    //上传项目文件回调方法
    function uploadCallback(_data){
    	if(callbackFlag==2){
	        $.ajax({
	            type: 'post',
	            dataType: 'json',
	            data: {'fileParams':JSON.stringify(_data),'prjId':$("#prjId").val(),'cfgCd':$("#cfgCd").val(),'cfgDtlCd':$("#cfgDtlCd").val(),'orgCd':$("#orgCd").val()},
	            url: '<%=path%>/project/prjFileInfo/uploadPrjFile.do',
	            success: function (msg) {
	                if (msg.success == 1) {
	                    parent.$('li[tabid="mateTab"] a').text('项目资料('+msg.data+')');
	                    /* if(prjFileInfoGrid){
		                    prjFileInfoGrid.reload();
	                    } */
	                    if(reloadChildGridId) liger.get(reloadChildGridId).reload();
	                }else{
	                    $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
	                }
	                $.ligerDialog.hide();
	            }
	        });
    	}
    }

    //删除文件
    function delFile(event,_fileId){
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {'fileId':_fileId},
            url: '<%=path%>/project/prjFileInfo/removeFile.do',
            beforeSend: function () {
               wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    parent.$('li[tabid="mateTab"] a').text('项目资料('+msg.data+')');
                    /* if(prjFileInfoGrid){
	                    prjFileInfoGrid.reload();
                    }
                    if(cstFileInfoGrid){
	                    cstFileInfoGrid.reload();
                    } */
                    event.stopPropagation();
                    var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
                    liger.get(gridID).reload();
                }else{
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //修改资料的验证状态
    function modifyAudStsCd(event,_fileId,_audStsCd){
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {'fileId':_fileId,'audStsCd':_audStsCd},
            url: '<%=path%>/project/prjFileInfo/modifyFileAudStsCd.do',
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    //$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    event.stopPropagation();
                    var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
                    liger.get(gridID).reload();
                }else{
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    function downFile(_url){
        //window.location.href=_url;
        window.open(_url);
    }
    function uploadFileByUrl(_url,_name){
		if(SQ.regs.img.test(_name)){
			//SQ.imgPreview(_url);
			//SQ.imgPreview(_url, true);
		   window.__ImgSrc = _url;
	       window.__ImgTit = _name;
	       window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
		}else if(SQ.regs.img.test(_url)){
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
	        window.open(_url);
		}
    }
    
</script>

</body>
</html>
